home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / fp.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  36.7 KB  |  1,403 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        fp.a
  3. ;
  4. ;    Contains:    FPCE Floating-Point Definitions and Declarations.
  5. ;
  6. ;    Version:    Technology:    MathLib v2
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1987-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__FP__') = 'UNDEFINED' THEN
  19. __FP__ SET 1
  20.  
  21.     IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
  22.     include 'ConditionalMacros.a'
  23.     ENDIF
  24.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  25.     include 'MacTypes.a'
  26.     ENDIF
  27.  
  28. ; ********************************************************************************
  29. ;*                                                                               *
  30. ;*    A collection of numerical functions designed to facilitate a wide          *
  31. ;*    range of numerical programming as required by C9X.                         *
  32. ;*                                                                               *
  33. ;*    The <fp.h> declares many functions in support of numerical programming.    *
  34. ;*    It provides a superset of <math.h> and <SANE.h> functions.  Some           *
  35. ;*    functionality previously found in <SANE.h> and not in the FPCE <fp.h>      *
  36. ;*    can be found in this <fp.h> under the heading "__NOEXTENSIONS__".          *
  37. ;*                                                                               *
  38. ;*    All of these functions are IEEE 754 aware and treat exceptions, NaNs,      *
  39. ;*    positive and negative zero and infinity consistent with the floating-      *
  40. ;*    point standard.                                                            *
  41. ;*                                                                               *
  42. ;*******************************************************************************
  43.  
  44.  
  45. ; ********************************************************************************
  46. ;*                                                                               *
  47. ;*                            Efficient types                                    *
  48. ;*                                                                               *
  49. ;*    float_t         Most efficient type at least as wide as float              *
  50. ;*    double_t        Most efficient type at least as wide as double             *
  51. ;*                                                                               *
  52. ;*      CPU            float_t(bits)                double_t(bits)               *
  53. ;*    --------        -----------------            -----------------             *
  54. ;*    PowerPC          float(32)                    double(64)                   *
  55. ;*    68K              long double(80/96)           long double(80/96)           *
  56. ;*    x86              long double(80)              long double(80)              *
  57. ;*                                                                               *
  58. ;*******************************************************************************
  59.  
  60.     IF TARGET_CPU_PPC THEN
  61. ; typedef float                         float_t
  62.  
  63. ; typedef double                         double_t
  64.  
  65.     ELSEIF TARGET_CPU_68K THEN
  66. ; typedef long double                     float_t
  67.  
  68. ; typedef long double                     double_t
  69.  
  70.     ELSEIF TARGET_CPU_X86 THEN
  71.     IF NeXT THEN
  72. ; typedef double                         float_t
  73.  
  74. ; typedef double                         double_t
  75.  
  76.     ELSE
  77. ; typedef long double                     float_t
  78.  
  79. ; typedef long double                     double_t
  80.  
  81.     ENDIF    ; NeXT
  82.     ELSEIF TARGET_CPU_MIPS THEN
  83. ; typedef double                         float_t
  84.  
  85. ; typedef double                         double_t
  86.  
  87.     ELSEIF TARGET_CPU_ALPHA THEN
  88. ; typedef double                         float_t
  89.  
  90. ; typedef double                         double_t
  91.  
  92.     ELSEIF TARGET_CPU_SPARC THEN
  93. ; typedef double                         float_t
  94.  
  95. ; typedef double                         double_t
  96.  
  97.     ELSE
  98.     ENDIF    ; TARGET_CPU_SPARC
  99.  
  100. ; ********************************************************************************
  101. ;*                                                                               *
  102. ;*                              Define some constants.                           *
  103. ;*                                                                               *
  104. ;*    HUGE_VAL            IEEE 754 value of infinity.                            *
  105. ;*    INFINITY            IEEE 754 value of infinity.                            *
  106. ;*    NAN                 A generic NaN (Not A Number).                          *
  107. ;*    DECIMAL_DIG         Satisfies the constraint that the conversion from      *
  108. ;*                        double to decimal and back is the identity function.   *
  109. ;*                                                                               *
  110. ;*******************************************************************************
  111.  
  112.     IF TARGET_OS_MAC THEN
  113. ; ********************************************************************************
  114. ;*                                                                               *
  115. ;*                            Trigonometric functions                            *
  116. ;*                                                                               *
  117. ;*   acos        result is in [0,pi].                                            *
  118. ;*   asin        result is in [-pi/2,pi/2].                                      *
  119. ;*   atan        result is in [-pi/2,pi/2].                                      *
  120. ;*   atan2       Computes the arc tangent of y/x in [-pi,pi] using the sign of   *
  121. ;*               both arguments to determine the quadrant of the computed value. *
  122. ;*                                                                               *
  123. ;*******************************************************************************
  124.  
  125. ;
  126. ; extern double_t cos(double_t x)
  127. ;
  128.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  129.         IMPORT_CFM_FUNCTION cos
  130.     ENDIF
  131.  
  132. ;
  133. ; extern double_t sin(double_t x)
  134. ;
  135.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  136.         IMPORT_CFM_FUNCTION sin
  137.     ENDIF
  138.  
  139. ;
  140. ; extern double_t tan(double_t x)
  141. ;
  142.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  143.         IMPORT_CFM_FUNCTION tan
  144.     ENDIF
  145.  
  146. ;
  147. ; extern double_t acos(double_t x)
  148. ;
  149.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  150.         IMPORT_CFM_FUNCTION acos
  151.     ENDIF
  152.  
  153. ;
  154. ; extern double_t asin(double_t x)
  155. ;
  156.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  157.         IMPORT_CFM_FUNCTION asin
  158.     ENDIF
  159.  
  160. ;
  161. ; extern double_t atan(double_t x)
  162. ;
  163.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  164.         IMPORT_CFM_FUNCTION atan
  165.     ENDIF
  166.  
  167. ;
  168. ; extern double_t atan2(double_t y, double_t x)
  169. ;
  170.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  171.         IMPORT_CFM_FUNCTION atan2
  172.     ENDIF
  173.  
  174.  
  175.  
  176. ; ********************************************************************************
  177. ;*                                                                                *
  178. ;*                              Hyperbolic functions                             *
  179. ;*                                                                                *
  180. ;*******************************************************************************
  181.  
  182. ;
  183. ; extern double_t cosh(double_t x)
  184. ;
  185.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  186.         IMPORT_CFM_FUNCTION cosh
  187.     ENDIF
  188.  
  189. ;
  190. ; extern double_t sinh(double_t x)
  191. ;
  192.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  193.         IMPORT_CFM_FUNCTION sinh
  194.     ENDIF
  195.  
  196. ;
  197. ; extern double_t tanh(double_t x)
  198. ;
  199.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  200.         IMPORT_CFM_FUNCTION tanh
  201.     ENDIF
  202.  
  203. ;
  204. ; extern double_t acosh(double_t x)
  205. ;
  206.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  207.         IMPORT_CFM_FUNCTION acosh
  208.     ENDIF
  209.  
  210. ;
  211. ; extern double_t asinh(double_t x)
  212. ;
  213.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  214.         IMPORT_CFM_FUNCTION asinh
  215.     ENDIF
  216.  
  217. ;
  218. ; extern double_t atanh(double_t x)
  219. ;
  220.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  221.         IMPORT_CFM_FUNCTION atanh
  222.     ENDIF
  223.  
  224.  
  225.  
  226. ; ********************************************************************************
  227. ;*                                                                                *
  228. ;*                              Exponential functions                               *
  229. ;*                                                                                *
  230. ;*    expm1        expm1(x) = exp(x) - 1.  But, for small enough arguments,          *
  231. ;*                expm1(x) is expected to be more accurate than exp(x) - 1.        *
  232. ;*    frexp        Breaks a floating-point number into a normalized fraction       *
  233. ;*                and an integral power of 2.  It stores the integer in the       *
  234. ;*                object pointed by *exponent.                                    *
  235. ;*    ldexp        Multiplies a floating-point    number by an integer power of 2.    *
  236. ;*    log1p        log1p = log(1 + x). But, for small enough arguments,              *
  237. ;*                 log1p is expected to be more accurate than log(1 + x).          *
  238. ;*    logb        Extracts the exponent of its argument, as a signed integral        *
  239. ;*                  value. A subnormal argument is treated as though it were first    *
  240. ;*                  normalized. Thus:                                                *
  241. ;*                                     1   <=   x * 2^(-logb(x))   <   2             *
  242. ;*    modf        Returns fractional part of x as function result and returns     *
  243. ;*                integral part of x via iptr. Note C9X uses double not double_t.    *
  244. ;*    scalb        Computes x * 2^n efficently.  This is not normally done by        *
  245. ;*                  computing 2^n explicitly.                                         *
  246. ;*                                                                                *
  247. ;*******************************************************************************
  248.  
  249. ;
  250. ; extern double_t exp(double_t x)
  251. ;
  252.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  253.         IMPORT_CFM_FUNCTION exp
  254.     ENDIF
  255.  
  256. ;
  257. ; extern double_t expm1(double_t x)
  258. ;
  259.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  260.         IMPORT_CFM_FUNCTION expm1
  261.     ENDIF
  262.  
  263. ;
  264. ; extern double_t exp2(double_t x)
  265. ;
  266.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  267.         IMPORT_CFM_FUNCTION exp2
  268.     ENDIF
  269.  
  270. ;
  271. ; extern double_t frexp(double_t x, int *exponent)
  272. ;
  273.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  274.         IMPORT_CFM_FUNCTION frexp
  275.     ENDIF
  276.  
  277. ;
  278. ; extern double_t ldexp(double_t x, int n)
  279. ;
  280.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  281.         IMPORT_CFM_FUNCTION ldexp
  282.     ENDIF
  283.  
  284. ;
  285. ; extern double_t log(double_t x)
  286. ;
  287.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  288.         IMPORT_CFM_FUNCTION log
  289.     ENDIF
  290.  
  291. ;
  292. ; extern double_t log2(double_t x)
  293. ;
  294.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  295.         IMPORT_CFM_FUNCTION log2
  296.     ENDIF
  297.  
  298. ;
  299. ; extern double_t log1p(double_t x)
  300. ;
  301.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  302.         IMPORT_CFM_FUNCTION log1p
  303.     ENDIF
  304.  
  305. ;
  306. ; extern double_t log10(double_t x)
  307. ;
  308.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  309.         IMPORT_CFM_FUNCTION log10
  310.     ENDIF
  311.  
  312. ;
  313. ; extern double_t logb(double_t x)
  314. ;
  315.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  316.         IMPORT_CFM_FUNCTION logb
  317.     ENDIF
  318.  
  319. ;
  320. ; extern double_t modf(double_t x, double_t *iptr)
  321. ;
  322.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  323.         IMPORT_CFM_FUNCTION modf
  324.     ENDIF
  325.  
  326. ;
  327. ; extern float modff(float x, float *iptrf)
  328. ;
  329.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  330.         IMPORT_CFM_FUNCTION modff
  331.     ENDIF
  332.  
  333. ;
  334. ; extern double_t scalb(double_t x, long n)
  335. ;
  336.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  337.         IMPORT_CFM_FUNCTION scalb
  338.     ENDIF
  339.  
  340.  
  341.  
  342. ; ********************************************************************************
  343. ;*                                                                                *
  344. ;*                     Power and absolute value functions                          *
  345. ;*                                                                                *
  346. ;*    hypot        Computes the square root of the sum of the squares of its        *
  347. ;*                  arguments, without undue overflow or underflow.                 *
  348. ;*    pow            Returns x raised to the power of y.  Result is more accurate    *
  349. ;*                than using exp(log(x)*y).                                        *
  350. ;*                                                                                *
  351. ;*******************************************************************************
  352.  
  353. ;
  354. ; extern double_t fabs(double_t x)
  355. ;
  356.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  357.         IMPORT_CFM_FUNCTION fabs
  358.     ENDIF
  359.  
  360. ;
  361. ; extern double_t hypot(double_t x, double_t y)
  362. ;
  363.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  364.         IMPORT_CFM_FUNCTION hypot
  365.     ENDIF
  366.  
  367. ;
  368. ; extern double_t pow(double_t x, double_t y)
  369. ;
  370.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  371.         IMPORT_CFM_FUNCTION pow
  372.     ENDIF
  373.  
  374. ;
  375. ; extern double_t sqrt(double_t x)
  376. ;
  377.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  378.         IMPORT_CFM_FUNCTION sqrt
  379.     ENDIF
  380.  
  381.  
  382.  
  383. ; ********************************************************************************
  384. ;*                                                                                 *
  385. ;*                        Gamma and Error functions                               *
  386. ;*                                                                                 *
  387. ;*     erf            The error function.                                             *
  388. ;*     erfc        Complementary error function.                                      *
  389. ;*     gamma        The gamma function.                                                *
  390. ;*     lgamma        Computes the base-e logarithm of the absolute value of            *
  391. ;*                 gamma of its argument x, for x > 0.                                *
  392. ;*                                                                                 *
  393. ;*******************************************************************************
  394.  
  395. ;
  396. ; extern double_t erf(double_t x)
  397. ;
  398.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  399.         IMPORT_CFM_FUNCTION erf
  400.     ENDIF
  401.  
  402. ;
  403. ; extern double_t erfc(double_t x)
  404. ;
  405.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  406.         IMPORT_CFM_FUNCTION erfc
  407.     ENDIF
  408.  
  409. ;
  410. ; extern double_t gamma(double_t x)
  411. ;
  412.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  413.         IMPORT_CFM_FUNCTION gamma
  414.     ENDIF
  415.  
  416. ;
  417. ; extern double_t lgamma(double_t x)
  418. ;
  419.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  420.         IMPORT_CFM_FUNCTION lgamma
  421.     ENDIF
  422.  
  423.  
  424.  
  425. ; ********************************************************************************
  426. ;*                                                                                 *
  427. ;*                        Nearest integer functions                                 *
  428. ;*                                                                                 *
  429. ;*     rint        Rounds its argument to an integral value in floating point         *
  430. ;*                  format, honoring the current rounding direction.                   *
  431. ;*                                                                                 *
  432. ;*     nearbyint    Differs from rint only in that it does not raise the inexact    *
  433. ;*               exception. It is the nearbyint function recommended by the        *
  434. ;*                  IEEE floating-point standard 854.                                  *
  435. ;*                                                                                 *
  436. ;*     rinttol        Rounds its argument to the nearest long int using the current     *
  437. ;*                  rounding direction.  NOTE: if the rounded value is outside        *
  438. ;*                the range of long int, then the result is undefined.              *
  439. ;*                                                                                  *
  440. ;*     round        Rounds the argument to the nearest integral value in floating     *
  441. ;*                  point format similar to the Fortran "anint" function. That is:  *
  442. ;*                  add half to the magnitude and chop.                             *
  443. ;*                                                                                 *
  444. ;*     roundtol    Similar to the Fortran function nint or to the Pascal round.    *
  445. ;*                 NOTE: if the rounded value is outside the range of long int,    *
  446. ;*                  then the result is undefined.                                      *
  447. ;*                                                                                 *
  448. ;*     trunc        Computes the integral value, in floating format, nearest to        *
  449. ;*                 but no larger in magnitude than its argument.      NOTE: on 68K    *
  450. ;*                compilers when using -elems881, trunc must return an int        *
  451. ;*                                                                                 *
  452. ;*******************************************************************************
  453.  
  454. ;
  455. ; extern double_t ceil(double_t x)
  456. ;
  457.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  458.         IMPORT_CFM_FUNCTION ceil
  459.     ENDIF
  460.  
  461. ;
  462. ; extern double_t floor(double_t x)
  463. ;
  464.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  465.         IMPORT_CFM_FUNCTION floor
  466.     ENDIF
  467.  
  468. ;
  469. ; extern double_t rint(double_t x)
  470. ;
  471.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  472.         IMPORT_CFM_FUNCTION rint
  473.     ENDIF
  474.  
  475. ;
  476. ; extern double_t nearbyint(double_t x)
  477. ;
  478.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  479.         IMPORT_CFM_FUNCTION nearbyint
  480.     ENDIF
  481.  
  482. ;
  483. ; extern long rinttol(double_t x)
  484. ;
  485.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  486.         IMPORT_CFM_FUNCTION rinttol
  487.     ENDIF
  488.  
  489. ;
  490. ; extern double_t round(double_t x)
  491. ;
  492.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  493.         IMPORT_CFM_FUNCTION round
  494.     ENDIF
  495.  
  496. ;
  497. ; extern long roundtol(double_t round)
  498. ;
  499.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  500.         IMPORT_CFM_FUNCTION roundtol
  501.     ENDIF
  502.  
  503.     IF TARGET_CPU_68K THEN
  504. ;
  505. ; extern int trunc(double_t x)
  506. ;
  507.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  508.         IMPORT_CFM_FUNCTION trunc
  509.     ENDIF
  510.  
  511.     ELSE
  512. ;
  513. ; extern double_t trunc(double_t x)
  514. ;
  515.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  516.         IMPORT_CFM_FUNCTION trunc
  517.     ENDIF
  518.  
  519.     ENDIF    ; TARGET_CPU_68K
  520.  
  521. ; ********************************************************************************
  522. ;*                                                                                 *
  523. ;*                            Remainder functions                                   *
  524. ;*                                                                                 *
  525. ;*     remainder        IEEE 754 floating point standard for remainder.                *
  526. ;*     remquo            SANE remainder.  It stores into 'quotient' the 7 low-order    *
  527. ;*                    bits of the integer quotient x/y, such that:                *
  528. ;*                        -127 <= quotient <= 127.                                 *
  529. ;*                                                                                 *
  530. ;*******************************************************************************
  531.  
  532. ;
  533. ; extern double_t fmod(double_t x, double_t y)
  534. ;
  535.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  536.         IMPORT_CFM_FUNCTION fmod
  537.     ENDIF
  538.  
  539. ;
  540. ; extern double_t remainder(double_t x, double_t y)
  541. ;
  542.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  543.         IMPORT_CFM_FUNCTION remainder
  544.     ENDIF
  545.  
  546. ;
  547. ; extern double_t remquo(double_t x, double_t y, int *quo)
  548. ;
  549.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  550.         IMPORT_CFM_FUNCTION remquo
  551.     ENDIF
  552.  
  553.  
  554.  
  555. ; ********************************************************************************
  556. ;*                                                                                 *
  557. ;*                             Auxiliary functions                               *
  558. ;*                                                                                 *
  559. ;*     copysign        Produces a value with the magnitude of its first argument    *
  560. ;*                      and sign of its second argument.  NOTE: the order of the     *
  561. ;*                      arguments matches the recommendation of the IEEE 754         *
  562. ;*                    floating point standard,  which is opposite from the SANE    *
  563. ;*                    copysign function.                                             *
  564. ;*                                                                                 *
  565. ;*     nan                The call 'nan("n-char-sequence")' returns a quiet NaN         *
  566. ;*                      with content indicated through tagp in the selected         *
  567. ;*                    data type format.                                              *
  568. ;*                                                                                *
  569. ;*     nextafter        Computes the next representable value after 'x' in the         *
  570. ;*                    direction of 'y'.  if x == y, then y is returned.            *
  571. ;*                                                                                 *
  572. ;*******************************************************************************
  573.  
  574. ;
  575. ; extern double_t copysign(double_t x, double_t y)
  576. ;
  577.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  578.         IMPORT_CFM_FUNCTION copysign
  579.     ENDIF
  580.  
  581. ;
  582. ; extern double nan(const char *tagp)
  583. ;
  584.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  585.         IMPORT_CFM_FUNCTION nan
  586.     ENDIF
  587.  
  588. ;
  589. ; extern float nanf(const char *tagp)
  590. ;
  591.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  592.         IMPORT_CFM_FUNCTION nanf
  593.     ENDIF
  594.  
  595. ;
  596. ; extern double nextafterd(double x, double y)
  597. ;
  598.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  599.         IMPORT_CFM_FUNCTION nextafterd
  600.     ENDIF
  601.  
  602. ;
  603. ; extern float nextafterf(float x, float y)
  604. ;
  605.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  606.         IMPORT_CFM_FUNCTION nextafterf
  607.     ENDIF
  608.  
  609.  
  610.  
  611. ; ********************************************************************************
  612. ;*                                                                                 *
  613. ;*                              Inquiry macros                                   *
  614. ;*                                                                                 *
  615. ;*     fpclassify        Returns one of the FP_≈ values.                                *
  616. ;*     isnormal        Non-zero if and only if the argument x is normalized.          *
  617. ;*     isfinite        Non-zero if and only if the argument x is finite.             *
  618. ;*     isnan            Non-zero if and only if the argument x is a NaN.              *
  619. ;*     signbit            Non-zero if and only if the sign of the argument x is        *
  620. ;*                      negative.  This includes, NaNs, infinities and zeros.         *
  621. ;*                                                                                 *
  622. ;*******************************************************************************
  623.  
  624.  
  625. FP_SNAN                            EQU        0                    ;      signaling NaN                         
  626. FP_QNAN                            EQU        1                    ;      quiet NaN                             
  627. FP_INFINITE                        EQU        2                    ;      + or - infinity                       
  628. FP_ZERO                            EQU        3                    ;      + or - zero                           
  629. FP_NORMAL                        EQU        4                    ;      all normal numbers                    
  630. FP_SUBNORMAL                    EQU        5                    ;      denormal numbers                      
  631. ;
  632. ; extern long __fpclassifyd(double x)
  633. ;
  634.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  635.         IMPORT_CFM_FUNCTION __fpclassifyd
  636.     ENDIF
  637.  
  638. ;
  639. ; extern long __fpclassifyf(float x)
  640. ;
  641.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  642.         IMPORT_CFM_FUNCTION __fpclassifyf
  643.     ENDIF
  644.  
  645. ;
  646. ; extern long __isnormald(double x)
  647. ;
  648.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  649.         IMPORT_CFM_FUNCTION __isnormald
  650.     ENDIF
  651.  
  652. ;
  653. ; extern long __isnormalf(float x)
  654. ;
  655.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  656.         IMPORT_CFM_FUNCTION __isnormalf
  657.     ENDIF
  658.  
  659. ;
  660. ; extern long __isfinited(double x)
  661. ;
  662.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  663.         IMPORT_CFM_FUNCTION __isfinited
  664.     ENDIF
  665.  
  666. ;
  667. ; extern long __isfinitef(float x)
  668. ;
  669.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  670.         IMPORT_CFM_FUNCTION __isfinitef
  671.     ENDIF
  672.  
  673. ;
  674. ; extern long __isnand(double x)
  675. ;
  676.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  677.         IMPORT_CFM_FUNCTION __isnand
  678.     ENDIF
  679.  
  680. ;
  681. ; extern long __isnanf(float x)
  682. ;
  683.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  684.         IMPORT_CFM_FUNCTION __isnanf
  685.     ENDIF
  686.  
  687. ;
  688. ; extern long __signbitd(double x)
  689. ;
  690.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  691.         IMPORT_CFM_FUNCTION __signbitd
  692.     ENDIF
  693.  
  694. ;
  695. ; extern long __signbitf(float x)
  696. ;
  697.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  698.         IMPORT_CFM_FUNCTION __signbitf
  699.     ENDIF
  700.  
  701. ;
  702. ; extern double_t __inf(void )
  703. ;
  704.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  705.         IMPORT_CFM_FUNCTION __inf
  706.     ENDIF
  707.  
  708.  
  709.  
  710. ; ********************************************************************************
  711. ;*                                                                                 *
  712. ;*                      Max, Min and Positive Difference                         *
  713. ;*                                                                                 *
  714. ;*     fdim        Determines the 'positive difference' between its arguments:     *
  715. ;*                { x - y, if x > y }, { +0, if x <= y }.  If one argument is        *
  716. ;*                  NaN, then fdim returns that NaN.  if both arguments are NaNs,     *
  717. ;*                 then fdim returns the first argument.                            *
  718. ;*                                                                                 *
  719. ;*     fmax        Returns the maximum of the two arguments.  Corresponds to the    *
  720. ;*                max function in FORTRAN.  NaN arguments are treated as missing     *
  721. ;*                data.  If one argument is NaN and the other is a number, then     *
  722. ;*                the number is returned.  If both are NaNs then the first         *
  723. ;*                argument is returned.                                             *
  724. ;*                                                                                 *
  725. ;*     fmin        Returns the minimum of the two arguments.  Corresponds to the    *
  726. ;*                min function in FORTRAN.  NaN arguments are treated as missing     *
  727. ;*                data.  If one argument is NaN and the other is a number, then     *
  728. ;*                the number is returned.  If both are NaNs then the first         *
  729. ;*                argument is returned.                                            *
  730. ;*                                                                                 *
  731. ;*******************************************************************************
  732.  
  733. ;
  734. ; extern double_t fdim(double_t x, double_t y)
  735. ;
  736.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  737.         IMPORT_CFM_FUNCTION fdim
  738.     ENDIF
  739.  
  740. ;
  741. ; extern double_t fmax(double_t x, double_t y)
  742. ;
  743.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  744.         IMPORT_CFM_FUNCTION fmax
  745.     ENDIF
  746.  
  747. ;
  748. ; extern double_t fmin(double_t x, double_t y)
  749. ;
  750.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  751.         IMPORT_CFM_FUNCTION fmin
  752.     ENDIF
  753.  
  754.  
  755.  
  756. ; *******************************************************************************
  757. ;*                                Constants                                     *
  758. ;******************************************************************************
  759.  
  760.  
  761.  
  762. ; ********************************************************************************
  763. ;*                                                                                 *
  764. ;*                              Non NCEG extensions                                *
  765. ;*                                                                                 *
  766. ;*******************************************************************************
  767.  
  768.     IF &TYPE('__NOEXTENSIONS__') = 'UNDEFINED' THEN
  769. ; ********************************************************************************
  770. ;*                                                                                 *
  771. ;*                              Financial functions                              *
  772. ;*                                                                                 *
  773. ;*     compound        Computes the compound interest factor "(1 + rate)^periods"    *
  774. ;*                      more accurately than the straightforward computation with     *
  775. ;*                    the Power function.  This is SANE's compound function.      *
  776. ;*                                                                                 *
  777. ;*     annuity            Computes the present value factor for an annuity             *
  778. ;*                      "(1 - (1 + rate)^(-periods)) /rate" more accurately than    *
  779. ;*                    the straightforward computation with the Power function.     *
  780. ;*                    This is SANE's annuity function.                              *
  781. ;*                                                                                 *
  782. ;*******************************************************************************
  783.  
  784. ;
  785. ; extern double_t compound(double_t rate, double_t periods)
  786. ;
  787.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  788.         IMPORT_CFM_FUNCTION compound
  789.     ENDIF
  790.  
  791. ;
  792. ; extern double_t annuity(double_t rate, double_t periods)
  793. ;
  794.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  795.         IMPORT_CFM_FUNCTION annuity
  796.     ENDIF
  797.  
  798.  
  799.  
  800. ; ********************************************************************************
  801. ;*                                                                                 *
  802. ;*                              Random function                                  *
  803. ;*                                                                                 *
  804. ;*     randomx            A pseudorandom number generator.  It uses the iteration:    *
  805. ;*                                (75*x)mod(2^31-1)                                *
  806. ;*                                                                                 *
  807. ;*******************************************************************************
  808.  
  809. ;
  810. ; extern double_t randomx(double_t *x)
  811. ;
  812.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  813.         IMPORT_CFM_FUNCTION randomx
  814.     ENDIF
  815.  
  816.  
  817.  
  818. ; *******************************************************************************
  819. ;*                              Relational operator                             *
  820. ;******************************************************************************
  821.  
  822. ;       relational operator      
  823. ; typedef short                         relop
  824.  
  825.  
  826. GREATERTHAN                        EQU        0
  827. LESSTHAN                        EQU        1
  828. EQUALTO                            EQU        2
  829. UNORDERED                        EQU        3
  830. ;
  831. ; extern relop relation(double_t x, double_t y)
  832. ;
  833.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  834.         IMPORT_CFM_FUNCTION relation
  835.     ENDIF
  836.  
  837.  
  838.  
  839. ; ********************************************************************************
  840. ;*                                                                                 *
  841. ;*                         Binary to decimal conversions                         *
  842. ;*                                                                                 *
  843. ;*     SIGDIGLEN    Significant decimal digits.                                        *
  844. ;*                                                                                 *
  845. ;*     decimal        A record which provides an intermediate unpacked form for        *
  846. ;*                programmers who wish to do their own parsing of numeric input     *
  847. ;*                or formatting of numeric output.                                  *
  848. ;*                                                                                 *
  849. ;*     decform        Controls each conversion to a decimal string.  The style field     *
  850. ;*                is either FLOATDECIMAL or FIXEDDECIMAL. If FLOATDECIMAL, the     *
  851. ;*                value of the field digits is the number of significant digits.  *
  852. ;*                  If FIXEDDECIMAL value of the field digits is the number of        *
  853. ;*                digits to the right of the decimal point.                         *
  854. ;*                                                                                 *
  855. ;*     num2dec        Converts a double_t to a decimal record    using a decform.        *
  856. ;*     dec2num        Converts a decimal record d to a double_t value.                *
  857. ;*     dec2str        Converts a decform and decimal to a string using a decform.        *
  858. ;*     str2dec        Converts a string to a decimal struct.                            *
  859. ;*     dec2d        Similar to dec2num except a double is returned (68k only).        *
  860. ;*     dec2f        Similar to dec2num except a float is returned.                    *
  861. ;*     dec2s        Similar to dec2num except a short is returned.                    *
  862. ;*     dec2l        Similar to dec2num except a long is returned.                     *
  863. ;*                                                                                 *
  864. ;*******************************************************************************
  865.  
  866.     IF TARGET_CPU_PPC THEN
  867.  
  868. SIGDIGLEN                        EQU        36
  869.     ELSE
  870.  
  871. SIGDIGLEN                        EQU        20
  872.     ENDIF    ; TARGET_CPU_PPC
  873.  
  874. DECSTROUTLEN                    EQU        80                    ; max length for dec2str output 
  875.  
  876. decimal                    RECORD 0
  877. sgn                         ds.b    1                ; offset: $0 (0)        ;  sign 0 for +, 1 for - 
  878. unused                     ds.b    1                ; offset: $1 (1)
  879. exp                         ds.w    1                ; offset: $2 (2)        ;  decimal exponent 
  880. sig                         ds.b    SIGDIGLEN+2        ; offset: $4 (4)        ;  significant digits (pascal string)
  881. sizeof                     EQU *                    ; size:   $1A (26) or $2A (42)
  882.                         ENDR
  883.  
  884. decform                    RECORD 0
  885. style                     ds.b    1                ; offset: $0 (0)        ;  FLOATDECIMAL or FIXEDDECIMAL 
  886. unused                     ds.b    1                ; offset: $1 (1)
  887. digits                     ds.w    1                ; offset: $2 (2)
  888. sizeof                     EQU *                    ; size:   $4 (4)
  889.                         ENDR
  890. ;
  891. ; extern void num2dec(const decform *f, double_t x, decimal *d)
  892. ;
  893.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  894.         IMPORT_CFM_FUNCTION num2dec
  895.     ENDIF
  896.  
  897. ;
  898. ; extern double_t dec2num(const decimal *d)
  899. ;
  900.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  901.         IMPORT_CFM_FUNCTION dec2num
  902.     ENDIF
  903.  
  904. ;
  905. ; extern void dec2str(const decform *f, const decimal *d, char *s)
  906. ;
  907.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  908.         IMPORT_CFM_FUNCTION dec2str
  909.     ENDIF
  910.  
  911. ;
  912. ; extern void str2dec(const char *s, short *ix, decimal *d, short *vp)
  913. ;
  914.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  915.         IMPORT_CFM_FUNCTION str2dec
  916.     ENDIF
  917.  
  918.     IF TARGET_CPU_68K THEN
  919. ;
  920. ; extern double dec2d(const decimal *d)
  921. ;
  922.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  923.         IMPORT_CFM_FUNCTION dec2d
  924.     ENDIF
  925.  
  926.     ENDIF    ; TARGET_CPU_68K
  927. ;
  928. ; extern float dec2f(const decimal *d)
  929. ;
  930.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  931.         IMPORT_CFM_FUNCTION dec2f
  932.     ENDIF
  933.  
  934. ;
  935. ; extern short dec2s(const decimal *d)
  936. ;
  937.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  938.         IMPORT_CFM_FUNCTION dec2s
  939.     ENDIF
  940.  
  941. ;
  942. ; extern long dec2l(const decimal *d)
  943. ;
  944.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  945.         IMPORT_CFM_FUNCTION dec2l
  946.     ENDIF
  947.  
  948.  
  949.  
  950.  
  951. ; ********************************************************************************
  952. ;*                                                                                 *
  953. ;*                         68k-only Transfer Function Prototypes                 *
  954. ;*                                                                                 *
  955. ;*******************************************************************************
  956.  
  957.     IF TARGET_CPU_68K THEN
  958.     IF TARGET_RT_MAC_68881 THEN
  959. ;
  960. ; extern void x96tox80(const extended96 *x, extended80 *x80)
  961. ;
  962.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  963.         IMPORT_CFM_FUNCTION x96tox80
  964.     ENDIF
  965.  
  966. ;
  967. ; extern void x80tox96(const extended80 *x80, extended96 *x)
  968. ;
  969.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  970.         IMPORT_CFM_FUNCTION x80tox96
  971.     ENDIF
  972.  
  973.     ELSE
  974. ;
  975. ; extern void x96tox80(const extended96 *x96, extended80 *x)
  976. ;
  977.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  978.         IMPORT_CFM_FUNCTION x96tox80
  979.     ENDIF
  980.  
  981. ;
  982. ; extern void x80tox96(const extended80 *x, extended96 *x96)
  983. ;
  984.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  985.         IMPORT_CFM_FUNCTION x80tox96
  986.     ENDIF
  987.  
  988.     ENDIF    ; TARGET_RT_MAC_68881
  989.     ENDIF    ; TARGET_CPU_68K
  990.     ENDIF
  991. ; ********************************************************************************
  992. ;*                                                                                 *
  993. ;*                         PowerPC-only Function Prototypes                         *
  994. ;*                                                                                 *
  995. ;*******************************************************************************
  996.  
  997.  
  998.     IF TARGET_CPU_PPC THEN
  999. ;
  1000. ; extern long double cosl(long double x)
  1001. ;
  1002.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1003.         IMPORT_CFM_FUNCTION cosl
  1004.     ENDIF
  1005.  
  1006. ;
  1007. ; extern long double sinl(long double x)
  1008. ;
  1009.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1010.         IMPORT_CFM_FUNCTION sinl
  1011.     ENDIF
  1012.  
  1013. ;
  1014. ; extern long double tanl(long double x)
  1015. ;
  1016.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1017.         IMPORT_CFM_FUNCTION tanl
  1018.     ENDIF
  1019.  
  1020. ;
  1021. ; extern long double acosl(long double x)
  1022. ;
  1023.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1024.         IMPORT_CFM_FUNCTION acosl
  1025.     ENDIF
  1026.  
  1027. ;
  1028. ; extern long double asinl(long double x)
  1029. ;
  1030.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1031.         IMPORT_CFM_FUNCTION asinl
  1032.     ENDIF
  1033.  
  1034. ;
  1035. ; extern long double atanl(long double x)
  1036. ;
  1037.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1038.         IMPORT_CFM_FUNCTION atanl
  1039.     ENDIF
  1040.  
  1041. ;
  1042. ; extern long double atan2l(long double y, long double x)
  1043. ;
  1044.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1045.         IMPORT_CFM_FUNCTION atan2l
  1046.     ENDIF
  1047.  
  1048. ;
  1049. ; extern long double coshl(long double x)
  1050. ;
  1051.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1052.         IMPORT_CFM_FUNCTION coshl
  1053.     ENDIF
  1054.  
  1055. ;
  1056. ; extern long double sinhl(long double x)
  1057. ;
  1058.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1059.         IMPORT_CFM_FUNCTION sinhl
  1060.     ENDIF
  1061.  
  1062. ;
  1063. ; extern long double tanhl(long double x)
  1064. ;
  1065.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1066.         IMPORT_CFM_FUNCTION tanhl
  1067.     ENDIF
  1068.  
  1069. ;
  1070. ; extern long double acoshl(long double x)
  1071. ;
  1072.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1073.         IMPORT_CFM_FUNCTION acoshl
  1074.     ENDIF
  1075.  
  1076. ;
  1077. ; extern long double asinhl(long double x)
  1078. ;
  1079.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1080.         IMPORT_CFM_FUNCTION asinhl
  1081.     ENDIF
  1082.  
  1083. ;
  1084. ; extern long double atanhl(long double x)
  1085. ;
  1086.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1087.         IMPORT_CFM_FUNCTION atanhl
  1088.     ENDIF
  1089.  
  1090. ;
  1091. ; extern long double expl(long double x)
  1092. ;
  1093.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1094.         IMPORT_CFM_FUNCTION expl
  1095.     ENDIF
  1096.  
  1097. ;
  1098. ; extern long double expm1l(long double x)
  1099. ;
  1100.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1101.         IMPORT_CFM_FUNCTION expm1l
  1102.     ENDIF
  1103.  
  1104. ;
  1105. ; extern long double exp2l(long double x)
  1106. ;
  1107.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1108.         IMPORT_CFM_FUNCTION exp2l
  1109.     ENDIF
  1110.  
  1111. ;
  1112. ; extern long double frexpl(long double x, int *exponent)
  1113. ;
  1114.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1115.         IMPORT_CFM_FUNCTION frexpl
  1116.     ENDIF
  1117.  
  1118. ;
  1119. ; extern long double ldexpl(long double x, int n)
  1120. ;
  1121.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1122.         IMPORT_CFM_FUNCTION ldexpl
  1123.     ENDIF
  1124.  
  1125. ;
  1126. ; extern long double logl(long double x)
  1127. ;
  1128.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1129.         IMPORT_CFM_FUNCTION logl
  1130.     ENDIF
  1131.  
  1132. ;
  1133. ; extern long double log1pl(long double x)
  1134. ;
  1135.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1136.         IMPORT_CFM_FUNCTION log1pl
  1137.     ENDIF
  1138.  
  1139. ;
  1140. ; extern long double log10l(long double x)
  1141. ;
  1142.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1143.         IMPORT_CFM_FUNCTION log10l
  1144.     ENDIF
  1145.  
  1146. ;
  1147. ; extern long double log2l(long double x)
  1148. ;
  1149.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1150.         IMPORT_CFM_FUNCTION log2l
  1151.     ENDIF
  1152.  
  1153. ;
  1154. ; extern long double logbl(long double x)
  1155. ;
  1156.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1157.         IMPORT_CFM_FUNCTION logbl
  1158.     ENDIF
  1159.  
  1160. ;
  1161. ; extern long double scalbl(long double x, long n)
  1162. ;
  1163.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1164.         IMPORT_CFM_FUNCTION scalbl
  1165.     ENDIF
  1166.  
  1167. ;
  1168. ; extern long double fabsl(long double x)
  1169. ;
  1170.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1171.         IMPORT_CFM_FUNCTION fabsl
  1172.     ENDIF
  1173.  
  1174. ;
  1175. ; extern long double hypotl(long double x, long double y)
  1176. ;
  1177.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1178.         IMPORT_CFM_FUNCTION hypotl
  1179.     ENDIF
  1180.  
  1181. ;
  1182. ; extern long double powl(long double x, long double y)
  1183. ;
  1184.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1185.         IMPORT_CFM_FUNCTION powl
  1186.     ENDIF
  1187.  
  1188. ;
  1189. ; extern long double sqrtl(long double x)
  1190. ;
  1191.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1192.         IMPORT_CFM_FUNCTION sqrtl
  1193.     ENDIF
  1194.  
  1195. ;
  1196. ; extern long double erfl(long double x)
  1197. ;
  1198.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1199.         IMPORT_CFM_FUNCTION erfl
  1200.     ENDIF
  1201.  
  1202. ;
  1203. ; extern long double erfcl(long double x)
  1204. ;
  1205.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1206.         IMPORT_CFM_FUNCTION erfcl
  1207.     ENDIF
  1208.  
  1209. ;
  1210. ; extern long double gammal(long double x)
  1211. ;
  1212.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1213.         IMPORT_CFM_FUNCTION gammal
  1214.     ENDIF
  1215.  
  1216. ;
  1217. ; extern long double lgammal(long double x)
  1218. ;
  1219.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1220.         IMPORT_CFM_FUNCTION lgammal
  1221.     ENDIF
  1222.  
  1223. ;
  1224. ; extern long double ceill(long double x)
  1225. ;
  1226.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1227.         IMPORT_CFM_FUNCTION ceill
  1228.     ENDIF
  1229.  
  1230. ;
  1231. ; extern long double floorl(long double x)
  1232. ;
  1233.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1234.         IMPORT_CFM_FUNCTION floorl
  1235.     ENDIF
  1236.  
  1237. ;
  1238. ; extern long double rintl(long double x)
  1239. ;
  1240.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1241.         IMPORT_CFM_FUNCTION rintl
  1242.     ENDIF
  1243.  
  1244. ;
  1245. ; extern long double nearbyintl(long double x)
  1246. ;
  1247.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1248.         IMPORT_CFM_FUNCTION nearbyintl
  1249.     ENDIF
  1250.  
  1251. ;
  1252. ; extern long rinttoll(long double x)
  1253. ;
  1254.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1255.         IMPORT_CFM_FUNCTION rinttoll
  1256.     ENDIF
  1257.  
  1258. ;
  1259. ; extern long double roundl(long double x)
  1260. ;
  1261.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1262.         IMPORT_CFM_FUNCTION roundl
  1263.     ENDIF
  1264.  
  1265. ;
  1266. ; extern long roundtoll(long double round)
  1267. ;
  1268.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1269.         IMPORT_CFM_FUNCTION roundtoll
  1270.     ENDIF
  1271.  
  1272. ;
  1273. ; extern long double truncl(long double x)
  1274. ;
  1275.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1276.         IMPORT_CFM_FUNCTION truncl
  1277.     ENDIF
  1278.  
  1279. ;
  1280. ; extern long double remainderl(long double x, long double y)
  1281. ;
  1282.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1283.         IMPORT_CFM_FUNCTION remainderl
  1284.     ENDIF
  1285.  
  1286. ;
  1287. ; extern long double remquol(long double x, long double y, int *quo)
  1288. ;
  1289.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1290.         IMPORT_CFM_FUNCTION remquol
  1291.     ENDIF
  1292.  
  1293. ;
  1294. ; extern long double copysignl(long double x, long double y)
  1295. ;
  1296.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1297.         IMPORT_CFM_FUNCTION copysignl
  1298.     ENDIF
  1299.  
  1300. ;
  1301. ; extern long double fdiml(long double x, long double y)
  1302. ;
  1303.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1304.         IMPORT_CFM_FUNCTION fdiml
  1305.     ENDIF
  1306.  
  1307. ;
  1308. ; extern long double fmaxl(long double x, long double y)
  1309. ;
  1310.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1311.         IMPORT_CFM_FUNCTION fmaxl
  1312.     ENDIF
  1313.  
  1314. ;
  1315. ; extern long double fminl(long double x, long double y)
  1316. ;
  1317.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1318.         IMPORT_CFM_FUNCTION fminl
  1319.     ENDIF
  1320.  
  1321.  
  1322.     IF &TYPE('__NOEXTENSIONS__') = 'UNDEFINED' THEN
  1323. ;
  1324. ; extern relop relationl(long double x, long double y)
  1325. ;
  1326.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1327.         IMPORT_CFM_FUNCTION relationl
  1328.     ENDIF
  1329.  
  1330. ;
  1331. ; extern void num2decl(const decform *f, long double x, decimal *d)
  1332. ;
  1333.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1334.         IMPORT_CFM_FUNCTION num2decl
  1335.     ENDIF
  1336.  
  1337. ;
  1338. ; extern long double dec2numl(const decimal *d)
  1339. ;
  1340.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1341.         IMPORT_CFM_FUNCTION dec2numl
  1342.     ENDIF
  1343.  
  1344. ;     
  1345. ;    MathLib v2 has two new transfer functions: x80tod and dtox80.  They can 
  1346. ;    be used to directly transform 68k 80-bit extended data types to double
  1347. ;    and back for PowerPC based machines without using the functions
  1348. ;    x80told or ldtox80.  Double rounding may occur. 
  1349. ;
  1350.  
  1351. ;
  1352. ; extern void x80told(const extended80 *x80, long double *x)
  1353. ;
  1354.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1355.         IMPORT_CFM_FUNCTION x80told
  1356.     ENDIF
  1357.  
  1358. ;
  1359. ; extern void ldtox80(const long double *x, extended80 *x80)
  1360. ;
  1361.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1362.         IMPORT_CFM_FUNCTION ldtox80
  1363.     ENDIF
  1364.  
  1365. ;
  1366. ; extern double x80tod(const extended80 *x80)
  1367. ;
  1368.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1369.         IMPORT_CFM_FUNCTION x80tod
  1370.     ENDIF
  1371.  
  1372. ;
  1373. ; extern void dtox80(const double *x, extended80 *x80)
  1374. ;
  1375.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1376.         IMPORT_CFM_FUNCTION dtox80
  1377.     ENDIF
  1378.  
  1379.     ENDIF
  1380.     ENDIF    ; TARGET_CPU_PPC
  1381.     ELSE
  1382. ;    Non-Mac platforms may have long doubles.
  1383. ;
  1384.  
  1385. ;
  1386. ; extern void x80told(const extended80 *x80, long double *x)
  1387. ;
  1388.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1389.         IMPORT_CFM_FUNCTION x80told
  1390.     ENDIF
  1391.  
  1392. ;
  1393. ; extern void ldtox80(const long double *x, extended80 *x80)
  1394. ;
  1395.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  1396.         IMPORT_CFM_FUNCTION ldtox80
  1397.     ENDIF
  1398.  
  1399.     ENDIF    ; TARGET_OS_MAC
  1400.     ENDIF ; __FP__ 
  1401.  
  1402.